package com.learn.project2.service.wx.feedback;

import com.learn.project2.bean.MarketFeedback;
import com.learn.project2.bean.MarketUser;
import com.learn.project2.mapper.MarketFeedbackMapper;
import com.learn.project2.model.bo.wx.feedback.FeedbackSubmitBO;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.Date;

/**
 * @description:
 * @author zhizhuke
 * @date 2022-01-08 17-19
 * @version 1.0
 */
@Service
public class FeedbackServiceImpl2 implements FeedbackService2 {
    @Autowired
    MarketFeedbackMapper feedbackMapper;

    /** 
     * @description: 
     * @param:
     * @return:  
     * @author zhizhuke
     * @date: 2022-01-11 09:54
     */ 
    @Override
    public void submit(FeedbackSubmitBO submitBO) {

        Subject subject = SecurityUtils.getSubject();
        MarketUser user = (MarketUser) subject.getPrincipal();

        Date date = new Date();
        MarketFeedback marketFeedback = new MarketFeedback(null,user.getId(),user.getUsername(),submitBO.getMobile(),submitBO.getFeedType(),
                submitBO.getContent(),null,submitBO.getHasPicture(),submitBO.getPicUrls(), date, date,false);

        feedbackMapper.insertSelective(marketFeedback);

    }
}
